<template>
  <div class="box">
    <div ref="drag" class="box_drag">我会被拖动</div>
  </div>
</template>

<script> // vue3的语法糖，等同于在setup里面编写
import {onMounted, ref} from 'vue'
export default {
  name: 'Test',
  description: {
    // 工具
  },
  methods: {
    sumbit() {
    },
  },
  setup() {
    const drag = ref();
    onMounted(() => {
      console.log("drag", drag.value)
    })
    return{
      drag
    }
  }
}
</script>
<style scoped lang="css">
.btn {
  position: relative;
  width: auto;
  min-width: 120px;
  padding: 10px;
  text-align: center;
  color: #fff;
  background: #00d463;
  cursor: pointer;
  border-radius: 4px;
  border: none;
  transition-property: all;
  transition-duration: .8s;
}

.btn:after, .btn:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: #00d463;
  z-index: -2;
  border-radius: 4px;
}

.btn:hover {
  z-index: 1;
  /*background: transparent;*/
}

.btn:before {
  transition: 1s;
  background: #14ae5c;
  z-index: -1;
}

.btn:hover:after, .btn:hover:before {
  width: 100%;
}


</style>
